package com.vmj.instructions.math;

import com.vmj.instructions.base.NoOperandsInstruction;
import com.vmj.rtda.Frame;
import com.vmj.rtda.OperandStack;

/**
 * Created by yangshoujun on 2017/8/20 上午12:17.
 */
public class LRem extends NoOperandsInstruction {

    @Override
    public void execute(Frame frame) {
        OperandStack stack = frame.getOperandStack();
        long v2 = stack.popLong();
        long v1 = stack.popLong();
        if(v2 == 0) {
            throw new RuntimeException("除数为0.");
        }
        long result = v1 % v2;
        stack.pushLong(result);
    }
}
